<style rel="stylesheet/scss" lang="scss" scoped>
.dashboard-editor-container {
  padding: 18px 22px 22px 22px;
  background-color: rgb(240, 242, 245);
  margin-bottom: 80px;

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}

.form-operator-button {
  background-color: #fff;
  position: fixed;
  width: 100%;
  left: 0px;
  right: 0;
  bottom: 33px;
  height: 64px;
  line-height: 64px;
  text-align: right;
  box-shadow: 0 -1px 2px 0 rgba(0, 0, 0, 0.05);
  z-index: 10;
}

.form-el-radion {
  line-height: 30px;
  padding: 5px 0px;
  width: 100%;
}

.hex-form-inf {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  cursor: pointer;
  margin-right: 40px;
  position: relative;
  min-height: 33px;
  margin-left: 60px;
  line-height: 33px;
}

.hex-form-inf-content {
  font-size: 14px;
  font-weight: 500;
  display: none;
}

.hex-form-inf-icon {
  font-size: 20px;
  margin-top: 5px;
  position: absolute;
  right: 0px;
}

.hex-el-tabs {
  border: 1px solid #EBEEF5;
  background-color: #FFF;
  color: #303133;
  transition: .3s;
  border-radius: 4px;
  overflow: hidden;
  padding: 15px;
}
</style>
<template>
  <div>
    <el-descriptions class="margin-top" title="AgentSession详细信息" :column="3" :size="size" border>
      <!--      <template slot="extra">-->
      <!--        <el-button type="primary" size="small">操作</el-button>-->
      <!--      </template>-->
      <el-descriptions-item label="调度服务编码">{{ agentSessionInfo.agentCode }}</el-descriptions-item>
      <el-descriptions-item label="调度服务名称">{{ agentSessionInfo.agentName }}</el-descriptions-item>
      <el-descriptions-item label="调度服务状态">
        <el-tag size="small" type="success" v-if="agentSessionInfo.status === '1'">启用</el-tag>
        <el-tag size="small" type="danger" v-if="agentSessionInfo.status === '2'">停用</el-tag>
      </el-descriptions-item>
      <el-descriptions-item label="资源数使用情况">
        {{ agentSessionInfo.curResNum }}/{{ agentSessionInfo.resTotal }}
        <el-progress :percentage="agentSessionInfo.conUsageRate" :show-text=false color="#1CA965"></el-progress>
      </el-descriptions-item>
      <el-descriptions-item label="并发数使用情况">
        {{ agentSessionInfo.curConcurrentNum }}/{{ agentSessionInfo.concurrentTotal }}
        <el-progress :percentage="agentSessionInfo.conUsageRate" :show-text=false color="#1CA965"></el-progress>
      </el-descriptions-item>
      <el-descriptions-item label="调度服务主机">{{ agentSessionInfo.agentHost }}:{{ agentSessionInfo.agentPort }}</el-descriptions-item>
    </el-descriptions>
    <!--表格渲染-->
    <el-table max-height="300" height="300" v-loading="loading" ref="table" :data="agentSessionInfo.periodRunningList" style="width: 100%;"
              :header-cell-style="{ background: 'rgba(52, 125, 225, 0.1)', color: '#404248' }" border stripe>
      <el-table-column :show-overflow-tooltip="true" label="应用编码" prop="appCode"/>
      <el-table-column :show-overflow-tooltip="true" label="业务日期" prop="bizDate"/>
      <el-table-column :show-overflow-tooltip="true" label="任务编码" prop="taskCode"/>
      <el-table-column :show-overflow-tooltip="true" label="任务名称" prop="taskName"/>
      <el-table-column :show-overflow-tooltip="true" label="执行文件" prop="shellPath"/>
      <el-table-column :show-overflow-tooltip="true" label="作业编码" prop="jobCode"/>
      <el-table-column :show-overflow-tooltip="true" label="资源数" prop="resNum"/>
      <el-table-column :show-overflow-tooltip="true" label="执行开始时间" prop="execStTs"/>
      <el-table-column :show-overflow-tooltip="true" label="更新时间" prop="upTs"/>
      <el-table-column :show-overflow-tooltip="true" label="创建时间" prop="crtTs"/>
    </el-table>
    <el-table max-height="150" height="150" v-loading="loading" ref="table" :data="agentSessionInfo.deltaList" style="width: 100%;"
              :header-cell-style="{ background: 'rgba(52, 125, 225, 0.1)', color: '#404248' }" border stripe>
      <el-table-column :show-overflow-tooltip="true" label="应用编码" prop="appCode"/>
      <el-table-column :show-overflow-tooltip="true" label="业务日期" prop="bizDate"/>
      <el-table-column :show-overflow-tooltip="true" label="任务编码" prop="taskCode"/>
      <el-table-column :show-overflow-tooltip="true" label="任务名称" prop="taskName"/>
      <el-table-column :show-overflow-tooltip="true" label="执行文件" prop="shellPath"/>
      <el-table-column :show-overflow-tooltip="true" label="作业编码" prop="jobCode"/>
      <el-table-column :show-overflow-tooltip="true" label="资源数" prop="resNum"/>
      <el-table-column :show-overflow-tooltip="true" label="执行开始时间" prop="execStTs"/>
      <el-table-column :show-overflow-tooltip="true" label="更新时间" prop="upTs"/>
      <el-table-column :show-overflow-tooltip="true" label="创建时间" prop="crtTs"/>
    </el-table>
  </div>
</template>
<script>
import agentApi from '@/api/system/node.js'

export default {
  name: "agentSessionDetail",
  props: {
    agentCode: {
      type: String,
      default: null
    }
  },
  data() {
    return {
      loading: false,
      data: [],
      agentSessionInfo: {}
    };
  },
  created() {
    this.initData()
  },
  methods: {
    initData() {
      agentApi.qryAgentSessionInfo(this.agentCode).then(res => {
        this.agentSessionInfo = res
      })
    },
  },
};
</script>
